package com.whfc.fmam.context;

import com.whfc.common.spring.AppContextUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2020-11-26 14:14
 */
@Configuration
public class FmamContext {

    @Bean
    public AppContextUtil appContextUtil() {
        return new AppContextUtil();
    }

    @Bean
    public Executor taskExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setThreadGroupName("fmam-thg");
        taskExecutor.setThreadNamePrefix("fmam-th");
        taskExecutor.setCorePoolSize(10);
        taskExecutor.setMaxPoolSize(50);
        taskExecutor.setQueueCapacity(1024);
        taskExecutor.setKeepAliveSeconds(30000);
        return taskExecutor;
    }
}
